limsLocationBoard.squareKshPage = {

    getGridParam: function () {
        let _this = this;
        return {
            type: 'grid',
            id: 'lims-location-square-board-edit-list-grid',
            url: limsLocationBoard.baseUrl + '/queries/raw',
            service: 'limsLocationBoardServiceImpl',
            dbTable: 'T_LIMS_LOCATION_BOARD',
            columns: limsLocationBoard.getSquareEditListColumns(),
            onLoadSuccess: function (rows) {
                if (!Gikam.isEmpty(rows)) {
                    this.activeRowByIndex(0);
                } else {
                    Gikam.cleanCompData(['sample-square-Location']);
                }
            },
            onRowActive: function (index, row) {
                Gikam.refreshHole(row.id);
            },
            filterOpen: true,
            toolbar: [{
                type: 'button',
                text: 'GIKAM.BUTTON.INSERT',
                icon: 'add',
                onClick: function () {
                    Gikam.preInsert({
                        modalTitle: 'GIKAM.BUTTON.INSERT',
                        fields: limsLocationBoard.getBaseInfoFormFields(),
                        url: limsLocationBoard.baseUrl
                    }).done(function (id) {
                        Gikam.getComp('lims-location-square-board-edit-list-grid').refresh();
                    });
                }
            }, {
                type: 'button',
                text: 'GIKAM.BUTTON.DELETE',
                icon: 'remove-row',
                onClick: function () {
                    Gikam.getComp('lims-location-square-board-edit-list-grid').deleteRows(limsLocationBoard.baseUrl);
                }
            }],
            deleteFormatter: function (row) {
                return row.boardCode;
            },
            page: true,
            requestData: {
                createdByOrgId_EQ: workspace.user.ext$.loginorgid,
            },
            onCellClick: function (field, row) {
            },
        }
    },

    create: function () {
        var _this = this;
        Gikam.create('layout', {
            id: 'lims-location-square-board-edit-list-layout',
            renderTo: workspace.window.$dom,
            west: {
                width: '30%',
                title: 'T_LIMS_LOCATION_BOARD.GRID.TITLE',
                items: [this.getGridParam()]
            },
            center: {
                items : [{
                    type : 'layout',
                    center : {
                        items : [{
                            type: 'iframe',
                            src : '/static/basemodule/samplemanage/squareboard/index.html',
                            id : 'ksh-location-square-board-iframe'
                        }]
                    },
                    south : {
                        title : '板孔详情',
                        height : '15%',
                        items : [{
                            type : 'form',
                            columns : 2,
                            titleWidth : 60,
                            id : 'lims-square-hole-detail-form',
                            fields : [{
                                field : 'ext$.samplecode',
                                title : '孔号'
                            },{
                                field : 'locations',
                                title : '位置名称'
                            }]
                        }]
                    }
                }]
            }
        });
    },

    init: function () {
        this.create();
    }
};
